<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" import="java.text.DecimalFormat, java.util.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>银行卡提现</title>
    <script type="text/javascript">
        function showAlert() {

            alert("您的验证码是：666" );
        }
    </script>


    <style>
        body {
            background-color: #f2f2f2;
        }

        h1, label, input[type=submit], select {
            color: #333;
        }

        form {
            border: 2px solid #333;
            padding: 20px;
            border-radius: 10px;
            background-color: #fff;
            width: 400px;
            margin: 0 auto;
            box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3);
        }

        label {
            display: block;
            margin-bottom: 10px;
        }

        input[type=text], input[type=number], select {
            border: 1px solid #ddd;
            border-radius: 5px;
            padding: 5px;
            font-size: 16px;
            margin-bottom: 10px;
            width: 100%;
        }

        input[type=submit] {
            background-color: #333;
            color: #fff;
            border: none;
            padding: 10px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 18px;
            margin-top: 10px;
            width: 100%;
        }

        .error-msg {
            color: red;
            font-size: 14px;
            margin-top: 5px;
        }

    </style>
</head>
<body>
<h1>提现</h1>
<form action="/TransferServlet" method="post">
    <input type="hidden" name="action" value="withdrawal" />
    <label>选择银行卡:</label>
    <select name="cid">
        <c:forEach items="${user.userCards}" var="UserCard">


            <option>${UserCard.cid}</option>


        </c:forEach>
    </select><br>
    <label for="amount">提现金额：</label>
    <input type="number" name="amount" id="amount" required><br>
    <button onclick="showAlert()" >点击发送验证码</button>
    <label for="code">请输入验证码：</label>
    <input type="number" name="code" id="code" required><br>
    <%--格式化金额，保留两位小数--%>
    <%
        DecimalFormat df = new DecimalFormat("#.00");
        String errorMsg = (String) request.getAttribute("errorMsg");
        if (errorMsg != null && !errorMsg.equals("")) {
    %>
    <span class="error-msg"><%= errorMsg %></span>
    <%
        }
    %>
    <input type="submit" value="提现">
</form>


</body>
</html>